#ifndef VIEW_H
#define VIEW_H

#include <QObject>
#include <QStandardItemModel>
#include <QTableView>
#include <QStringList>
#include <QMap>
#include <QList>
#include "chart/chartwindow.h"
#include "chart/chartscene.h"

#define TIME_PATTERN "d. MMM yyyy hh:mm"
#define QSTANDARDITEM_IS_NO_TIME    0x01    //set in data section of a QStandardItem, when it should not handled as a time stamp

class View : public QStandardItemModel//,public depotView //depotView for getting all stock names, perhaps a better way is possible...
{

    Q_OBJECT
public:
    explicit View(QObject *parent = 0);
    ~View();
    void initModel(const QStringList& hHeader,const QStringList& vHeader=QStringList());
    void show(QTableView* View);
    void hide();
    void setStockData();

    /*stocknames and valuenames are necessary to get the values from yahoo*/
    void setStockNames(const QStringList& stocks);  //sets the stocknames yahoo-like
    void setValueNames(const QStringList& vNames);  //sets the valuenames yahoo-like

    virtual QStringList getStockNames()const =0;
    virtual QStringList getStockSymbols()const =0;
    virtual QStringList getValSymbols()const =0;

    virtual QStandardItem* getItem(int row,int col)=0;

    virtual void getColumnPairsFromDB(QList<QPointF>*,const QString&,const QString&,const QString&,bool)=0;    //saves pairs of values from two columns in a list


signals:
    void valueChangedSignal(QStandardItem *item, int type);
    void newValueSignal(const QString& stockName,QList<QStandardItem*> item);

public slots:
    void viewDoubleClicked(QModelIndex);
    /*if a value changed*/
    void valueChanged(QStandardItem* item,int type);
    void newValue(const QString& stockName,QList<QStandardItem*> item);

private:
    QStringList hHeaderStr,vHeaderStr,vHeaderStr_db;
    ChartWindow* chart;
    ChartScene* graph;

};

#endif // VIEW_H
